package com.tiku.controller;

import com.tiku.common.ResultJson;
import com.tiku.controller.TO.SetmealTO;
import com.tiku.service.CourseCategoriesService;
import com.tiku.service.ProfessionCategoriesService;
import com.tiku.service.SingleSubjectQuestionBanksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;

/**
 * 分类控制器
 */
@RestController
@RequestMapping("/classify")
@CrossOrigin("*")
public class ClassifyController {


    @Autowired
    private CourseCategoriesService courseCategoriesService;

    @Autowired
    private ProfessionCategoriesService professionCategoriesService;


    @Autowired
    private SingleSubjectQuestionBanksService singleSubjectQuestionBanksService;

    /**
     * 获取所有分类
     * @return
     */
    @GetMapping("/list")
    public ResultJson getClassList(){
        return courseCategoriesService.getClassList();
    }

    /**
     * 获取指定分类下的考试科目
     * @param examId
     * @return
     */
    @GetMapping("/examination/list/{ExaminationId}")
    public ResultJson getExaminationList(@PathVariable("ExaminationId")String examId){
        return professionCategoriesService.getExaminationList(examId);
    }

    /**
     * 获取指定考试科目下的题库
     * @param setmealTO
     * @return
     */
    @GetMapping("/setmeal/list/{examinationId}")
    public ResultJson setmealList(@PathVariable("examinationId") String setmealTO){
        return singleSubjectQuestionBanksService.setmealList(setmealTO);
    }

    /**
     * 获取指定题库下的类型与科目详细信息
     * @param setmealTO
     * @return
     */
    @PostMapping("/setmeal/info")
    public ResultJson setmealInfo(@RequestBody SetmealTO setmealTO){
        return singleSubjectQuestionBanksService.setmealInfo(setmealTO);
    }








}
